All Questions
Tagged with programming-practicesdesign
153 questions
0votes
0answers
62views
Web application having database with OPC client
I'm designing a browser-based application that will display real-time data collected from OPC server. I have decided to use Angular framework for the browser application development. The browser ...
2votes
4answers
3kviews
I wrote a class with "init" method. Should I call it from other class methods? Or leave it to the object user? (Code Design)
I have a java class with an init method. It's different from the constructor. The constructor just initializes the variables/fields. The init method connects to a database and performs some ...
23votes
6answers
6kviews
How important is it to clearly understand requirements and architecture before starting to code? [closed]
Whenever possible I have been requiring an understanding of the requirements and architecture for the next scope of work before starting to code. Sometimes due to schedule pressure on larger projects ...
-1votes
5answers
693views
Proving program correctness under all possible cases
There are techniques of proving program correctness under all possible cases, but that is a more advanced topic, for a later subject in your curriculum. I always had this doubt: Is it possible to ...
0votes
2answers
2kviews
Store static data in public folder as json file or directly in .js file?
I'm busy working on a website – somewhat new to this – and I don't quite know where I should store static data: in the public folder as a separate json file, or within the .js file as an object. In ...
2votes
2answers
584views
Design of a modular application
I'm developing an application (Java) in a modular architecture. I have two approaches in mind and I'm not sure which one will be "better code" in case of maintenance and conventions. I have ...
-1votes
3answers
700views
Improving APIs that call 3rd party APIs [closed]
So I'm designing the backend of a platform that often calls other 3rd party APIs. The issues I've noticed were latency issues (sometimes the calls were fast, others a bit slow >15s) and I'm ...
3votes
4answers
780views
Is it a bad practice to have an interface method to tell whether it can handle an object?
interface Resolver { boolean canResolve(SomeInput input); SomeOutput resolve(SomeInput input); } public static void main(String[] args) { List<Resolver> resolvers = ...; ...
-1votes
1answer
241views
How to avoid cyclic dependency in UI application
I'm developing an UI application where I ran into an issue with a cyclic dependency. Here is the simplified code, to explain the problem. #include <list> class UiStyle; UiStyle* CreateStyle(); ...
1vote
4answers
171views
How to design a program that would definitely use microservices in production, but which I want to demo on a virtual machine for my portfolio?
So I am an independent software developer and I'm building up my portfolio in the hopes of helping with job applications. I have a broad design for a web based "app" (not really like a phone ...
20votes
8answers
22kviews
Is an empty 'while' loop bad practice?
Consider the following: public boolean maybeUpdateTime() { if (this.timeReference.isAfter(lastInterval.getBeginning()) { this.timeReference = lastInterval.getEnd(); lastInterval = ...
0votes
3answers
202views
When using a DSL to structure my application, should I favor coupling the code with the DSL, or trying to have majority of my code independent of it?
We're currently using the Apache Camel Java DSL to structure our application, but I guess this question can mostly apply to any DSL in general. Now, amongst our developers, we are divided on two polar ...
0votes
1answer
386views
What is the most common stateless way for authentication in microservices?
I'm trying to get into Microservices by creating a project, so far I've stumbled upon authentication mechanisms, in a monolithic architecture, the client (web app) would send a request with the user ...
0votes
4answers
183views
Prevent developer errors / debugging help
How much should I factor in potential future developer error when writing code? This works better with a few examples: switch(something) case 1: return good; case 2: return fine; case 3: return ...
0votes
3answers
167views
Use the type returned by a function as information
Over time I become used to use the type of the returned value of a function as a piece of additional information. For example: A function that is supposed to return or an array if the arguments are ...